﻿@using NewRen.Models;
@using NewRen.Models.ViewModel;
@model  NewRen.Models.ViewModel.vEdit
@{
    Business business = ViewBag.Business as Business;
    List<Industry> industries = ViewBag.Industry;
    ViewBag.Title = "商户信息修改-商户修改";
    Layout = "~/Views/Shared/_Layout_Business.cshtml";

}
<script src="~/Scripts/jquery.datetimepicker.js"></script>
<div class="ucenter-left account-left-border">
    <div class="ucneter-l-head cf">
        <div class="ulhead-headicon">
            @if (business.Picture == null)
            {
                <img src="/Images/userphoto.png" width="50" height="50"
                     alt=@business.BusinessName style="border-radius:50%;" />
            }
            else
            {
                <img src="/Business/ShowPicture/@business.ID" width="50"
                     alt=@business.BusinessName height="50" style="border-radius:50%;" />
            }

        </div>
        <div class="ulhead-info">
            <p class="ulhead-info-uname">@business.BusinessName</p>

            <div class="ulhead-info-tool">
                <a class="ulhead-icon icon-lock ucenter-mail " href="/Business/PwdEdit/@business.ID" title="修改密码">
                    <div class="ucenter-mail-tip">修改密码</div>
                </a>
                <a href="/Business/Edit/@business.ID"
                   class="ulhead-icon icon-setting ucenter-mail" title="设置商户信息"></a>
            </div>
        </div>
    </div>
    <div class="ucenter-l-list">
        <ul class="ullist-ul">
            <li id="uclick">
                <a href="/Business/Show/@business.ID">商户中心</a>
            </li>
            <li id="uclick1" class="active">
                <a href="/Business/Edit/@business.ID">商户设置</a>
            </li>
            <li id="uclick2">
                <a href="/Business/ProductManager/@business.ID">商户商品</a>
            </li>
        </ul>
    </div>
</div>
<div class="ucenter-right cf">
    <div class="ucenter-right-head">
        <span class="ucenter-right-head-selected"><a href="/Business/Edit/@business.ID">信息修改</a></span>
        <span class="ucenter-right-head-show"><a href="/Business/PwdEdit/@business.ID">密码修改</a></span>
        <span class="ucenter-right-head-show"><a href="/Business/PictureEdit/@business.ID">更换头像</a></span>
        <span class="ucenter-right-head-show"><a href="/Business/BusinessPictureShow/@business.ID">宣传图片</a></span>
    </div>
    <div class="tabGroup">
        @using (Ajax.BeginForm("Edit", new { }, new AjaxOptions()
        {
            HttpMethod = "post",
            OnSuccess = "BusinessEditSucess",
            OnFailure= "BusinessEditFailure"
        }))
        {
            @Html.AntiForgeryToken()
            @Html.HiddenFor(model => model.ID, new { @Value = business.ID })
            <div class=" form-item">
                <div class="item-label">
                    <label>商户名：</label>
                </div>
                <div class="item-span">
                    @Html.TextBoxFor(model => model.BusinessName, new { @Value = business.BusinessName, @class = "txt sm" })
                </div>
            </div>
                <div class="form-item">
                    <div class="item-label">
                        <label>电话：</label>
                    </div>
                    <div class="item-span">
                        @Html.TextBoxFor(model => model.Phone, new { @Value = business.Phone, @class = "txt sm" })
                    </div>
                </div>
                <div class="form-item">
                    <div class="item-label">
                        <label>地址：</label>
                    </div>
                    <div class="item-span">
                        @Html.TextBoxFor(model => model.Address, new { @Value = business.Address, @class = "txt sm" })
                    </div>
                </div>
                <div class="form-item">
                    <div class="item-label">
                        <label>城市：</label>
                    </div>
                    <div class="item-span">
                        <select id="city" name="city" class="select">
                            @foreach (City item in ViewBag.Cities)
                            {
                                <option value="@item.CityName">@item.CityName</option>
                            }
                        </select>
                        <script>
                        if("@business.City"!="")
                        {
                            $("#city").val("@business.City");
                        }
                        </script>
                    </div>
                </div>
                <div class="form-item">
                    <div class="item-label">
                        <label>邮件：</label>
                    </div>
                    <div class="item-span">
                        @Html.TextBoxFor(model => model.Email, new { @Value = business.Email, @class = "txt sm" })
                    </div>
                </div>
                <div class="form-item">
                    <div class="item-label">
                        <label>微博：</label>
                    </div>
                    <div class="item-span">
                        @Html.TextBoxFor(model => model.Weibo, new { @Value = business.Weibo, @class = "txt sm" })
                    </div>
                </div>
                <div class="form-item">
                    <div class="item-label">
                        <label>微信：</label>
                    </div>
                    <div class="item-span">
                        @Html.TextBoxFor(model => model.WhatApp, new { @Value = business.WhatApp, @class = "txt sm" })
                    </div>
                </div>
                <div class="form-item">
                    <div class="item-label">
                        <label>行业：</label>
                    </div>
                    <div class="item-span">
                        <select id="Industry" name="Industry" class="select">
                            @foreach (Industry item in industries)
                            {
                                <option value="@item.IndustryName">@item.IndustryName</option>
                            }
                        </select>
                        <script>
                                if("@business.Industry"!="")
                                {
                                    $("#industry").val("@business.Industry");
                                }
                        </script>
                    </div>
                </div>
                <div class="form-item">
                    <div class="item-label">
                        <label>自我描述：</label>
                    </div>
                    <div class="item-span">
                        <textarea class="resize-none" name="description" id="description">@business.Description</textarea>
                    </div>
                </div>
                <div class="form-item">
                    <div class="item-span">
                        <input type="submit" value="保存" class="btn">
                    </div>
                </div>
        }
    </div>
</div>